package com.slz3.business.module.messageManagement.mesActivity.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.messageManagement.mesActivity.domain.MesActivity;
import com.slz3.business.module.messageManagement.mesActivity.domain.MesActivityFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class MesActivityTransactionalServiceImpl implements MesActivityTransactionalService {

    @Override
    public MesActivity modify(MesActivity mesActivityNew) {
        Repositorys.mesActivity.test();
        Repositorys.mesActivity.save(MesActivityFactory.initBaseFields());
        System.err.println(1/0);
        mesActivityNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.mesActivity.saveAndFlush(mesActivityNew);
    }

    @Override
    public List<MesActivity> batchModify(List<MesActivity> mesActivityList) {
        return Repositorys.mesActivity.saveAll(mesActivityList);
    }
}
